package com.rizzo.analytics.domain.notification;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import java.io.Serializable;

/**
 * Created with IntelliJ IDEA.
 * User: jalie
 * Date: 1/17/13
 * Time: 9:42 PM
 * To change this template use File | Settings | File Templates.
 */
public class Notification implements Serializable, Comparable<Notification> {

    private static final long serialVersionUID = 23L;

    private Long notificationId;

    private Double exceedValue;

    public Notification() {
    }

    public Notification(Long notificationId, Double exceedValue) {
        this.notificationId = notificationId;
        this.exceedValue = exceedValue;
    }

    public Long getNotificationId() {
        return notificationId;
    }

    public void setNotificationId(Long notificationId) {
        this.notificationId = notificationId;
    }

    public Double getExceedValue() {
        return exceedValue;
    }

    public void setExceedValue(Double exceedValue) {
        this.exceedValue = exceedValue;
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    public boolean equals(Object obj) {
        return EqualsBuilder.reflectionEquals(this, obj);
    }

    @Override
    public int compareTo(Notification o) {
        if (o.getNotificationId() != null && this.getNotificationId() != null) {
            return o.getNotificationId().compareTo(this.getNotificationId());
        } else if (o.getNotificationId() == null || this.getNotificationId() == null) {
            if (o.getNotificationId() == null) {
                return 1;
            } else {
                return -1;
            }
        } else {
            return 0;
        }
    }

    @Override
    public String toString() {
        return "Notification{" +
                "notificationId=" + notificationId +
                ", exceedValue=" + exceedValue +
                '}';
    }
}
